<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>3.v-if真正的使用场景</title>
    <!-- 引入Vue -->
    <script type="text/javascript" src="../../js/vue.js"></script>
  </head>
  <body>
    <!-- 准备好一个容器-->
    <div id="demo">
      <h2>姓名：{{person.name}}</h2>
      <h2>年龄：{{person.age}}</h2>
      <h2>有一个朋友</h2>
      <ul>
        <li v-if="person.firend">姓名：{{person.firend.name}}</li>
        <li v-if="person.firend">年龄：{{person.firend.age}}</li>
      </ul>
    </div>

    <script type="text/javascript">
      new Vue({
        el:'#demo',
        data:{
          person:{}
        }
      })
    </script>
  </body>
</html>